package example.db;

import org.junit.Test;

import java.sql.*;

import static org.junit.Assert.assertEquals;

public class DerbyExampleTest {
  @Test
  public void testDerbyExample() throws Exception {
    // 连接到Derby数据库

//    Class.forName("org.apache.derby.jdbc.Driver42");
    try (Connection conn = DriverManager.getConnection("jdbc:derby:C:/Users/yangyang/myderby");
         Statement stmt = conn.createStatement();
         ResultSet rs = stmt.executeQuery("SELECT * FROM douyin.like_video")) {

      // 处理结果集
      while (rs.next()) {
        int id = rs.getInt("id");
        String name = rs.getString("DESC");
        assertEquals("ID: " + id + ", Name: " + name, "expected result", "actual result");
      }
    }
  }
}
